#include <stdio.h> 

int main()
{
	int n = 0;
	int gold = 0, silver = 0, cuprum = 0;
	int totalGold = 0, totalSilver = 0, totalCuprum = 0;
	int total = 0;
	
	scanf("%d", &n);
	for ( int i = 0; i < n; i++ ) {
		scanf("%d %d %d", &gold, &silver, &cuprum);
		totalGold += gold;
		totalSilver += silver;
		totalCuprum += cuprum;
		total += (gold + silver + cuprum);
	}
	printf("%d %d %d %d", totalGold, totalSilver, totalCuprum, total);
	return 0;
}

